'use strict';

module.exports = function collectSameElements(collectionA, collectionB) {
  let result = [];
  for(let item of collectionA){
    if(ChoosetheSameA(collectionB,item)){
      result.push(item);
    }
  }
  return result;
}

function ChoosetheSameA(collection,i){
  for(let arr of collection){
    for(let item of arr){
      if(item === i){
        return true;
      }
    }
  }
  return false;
}